package com.framework.admin.controller;

import javax.validation.Valid;

import com.framework.admin.service.IRegisterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.framework.admin.domain.param.CompanyPwdParam;
import com.framework.admin.domain.param.CompanyRegisterParam;
import com.framework.common.domain.ResultData;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

@RestController
@RequestMapping("/register")
@Api(value = "register", tags = "注册")
public class RegisterController {

	@Autowired
    private IRegisterService registerService;
	
	@ResponseBody
    @ApiOperation(value = "注册")
    @PostMapping(value = "/register")
    public ResultData<String> register(@RequestBody @Valid CompanyRegisterParam param) {
		registerService.insertCompany(param);
        return ResultData.success();
    }
    
    @ResponseBody
    @ApiOperation(value = "更新密码")
    @PostMapping(value = "/updatePwd")
    public ResultData<String> updatePwd(@RequestBody @Valid CompanyPwdParam param) throws Exception {
    	registerService.updatePwd(param);
        return ResultData.success();
    }
}
